<template>
  <div>
    <div class="block">
      <el-pagination
        v-if='pageTotal > 0'
        background
        :page-size="paginations.pageSize"
        :layout="paginations.layout"
        :total="pageTotal"
        :current-page='paginations.pageIndex'
        @current-change='handleCurrentChange'
        @size-change='handleSizeChange'
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>

export default {
  data () {
    return {
      paginations: {
        pageIndex: 1,  // 当前位于哪页
        pageSize: 10,   // 1页显示多少条
        layout: 'total, prev, pager, next, jumper'   // 翻页属性
      }
    }
  },
  props: {
    pageTotal: Number
  },
  created () {

  },
  mounted () {

  },
  methods: {
    // 上下分页 pageIndex
    handleCurrentChange (currpage) {
      this.$emit('handleCurrentChange', currpage)
    },
    // 每页多少条切换 pageSize
    handleSizeChange (pagesize) {
      this.$emit('handleSizeChange', pagesize)
    }
  }
}
</script>

<style scoped>

</style>
